#pragma once

#include "EXDropListComboBoxResSet.h"

class CEXScrollBar;

class AFX_EXT_CLASS CEXDropListComboBox : public CComboBox
{
	DECLARE_DYNAMIC(CEXDropListComboBox)

public:
  enum LISTDOWN_COMBO_STYLE
  {
    NOIMAGE,
    LISTDOWN_COMBO_CTRL = 21,
  };

	CEXDropListComboBox();
	virtual ~CEXDropListComboBox();

	BOOL SetComboBgBitmaps(UINT nBkgndID, UINT nBtnID, int nCount, 
                        COLORREF crBkgnd, int nTopHeight = 0, 
                        int nBottomHeight = 0, int nLeftWidth = 0, 
                        int nRightWidth = 20);

	BOOL InitBgBitmap(CBitmap & src, CBitmap & bmpBtn, int index, int count);

	void SetListColor(COLORREF crNoral, COLORREF crFocus);
	void SetFontList(CString strDefaultFont);

  void SetResSet(CEXBaseResSet* pResSet);
  CEXDropListComboBoxResSet* m_pComboResSet;

protected:
	virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
	virtual void MeasureItem(LPMEASUREITEMSTRUCT lpMIS);

	void RecalcDropWidth();
	BOOL CursorInWindow();
	void DrawFrame(CDC * pDC);
	void MyDrawTextEx(CDC * pDC, int nIndex, CRect * prcText);


protected:

	enum STATUS
	{
		normal,
		focus,
		select,
		disable
	};

	// combo
	int m_nComboTopHeight;
	int m_nComboBottomHeight;
	int m_nComboLeftWidth;
	int m_nComboRightWidth;

	UINT m_nBtnID;
	UINT m_nComboBkgndID;
	int m_nComboNumOfBgPics;

	COLORREF m_crTransparent;
	COLORREF m_crComboBkgnd;
	COLORREF m_crListNormal;
	COLORREF m_crListFocus;

	BOOL m_bSetComboBg;

	CBitmap m_bmpBkgnd;

 	BOOL m_bSelect;
	BOOL m_bSetFont;

	CEXScrollBar * m_pScroll;

protected:
	DECLARE_MESSAGE_MAP()
	virtual void PreSubclassWindow();
public:
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnCbnCloseup();
	afx_msg void OnCbnDropdown();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnNcPaint();
	afx_msg void OnPaint();
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
};


